import { http } from "@/utils/http";

//登录
export const WebLogin = (data?: object) => {
  return http.request("post", `/user/webLogin`, { data });
};

//注册用户
export const addUser = (data?: object) => {
  return http.request("post", `/user/addUser`, {
    data
  });
};
// 查询所有人员信息
export const getAllUsers = (data?: object) => {
  return http.request("get", `/user/getAllUsers`, {
    data
  });
};
//分页查询标签信息
export const list = (data = {}) => {
  // 将 data 转换为查询字符串
  const queryParams = new URLSearchParams(data).toString();
  // 拼接查询字符串到 URL 后面
  return http.request("get", `/identityinformation/webList?${queryParams}`);
};
// 根据ID查询标签详情
export const identity = (data?: object) => {
  return http.request("get", `/identityinformation/identity`, {
    data
  });
};
//删除标签
export const deleteleaber = (id?: object) => {
  return http.request(
    "post",
    `/identityinformation/delete/${id}`,
  );
};
// 新增类别
export const addCategory = (data?: object) => {
  return http.request("post", `/category/addCategory`, {
    data
  });
};
// 查询所有类别
export const getAllCategories = (data?: object) => {
  return http.request("get", `/category/getAllCategories`, {
    data
  });
};
// 删除类别
export const delCategory = (data?: object) => {
  return http.request("post", `/category/delete`, { data
  });
};
// 修改用户设置
export const update = (data?: object) => {
  return http.request("post", `/user/update`, { data
  });
};
// 扫描标签码获取详情
export const createRecord = (data?: object) => {
  return http.request("post", `/identityrecord/createRecord`, { data
  });
};
// 分页查询已扫描二维码信息
export const getUserIdentityRecords = (data?: object) => {
  return http.request("post", `/identityrecord/getUserIdentityRecords`, { data
  });
};
// 确认
export const updateRecord= (data?: object) => {
  return http.request("post", `/identityrecord/updateRecord`, { data
  });
};
// 导出扫码枪扫码信息
export const export_biaoqian = (data?: object) => {
  return http.request("get", `/identityrecord/export`, {
    data,
   responseType: "blob"
  });
};

